package com.example.mybatis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.mybatis.entity.User;
import com.example.mybatis.mapper.UserMapper;
import com.example.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Devil
 * @create 2022-03-04 11:04
 */
@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;


    @Override
    public void delete() {
        User user = new User();
        user.setId(2);

        userMapper.deleteById(user);
    }

    @Override
    public void select() {
        LambdaQueryWrapper<User> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
        List<User> users = userMapper.selectList(userLambdaQueryWrapper);
        for (User user : users) {
            System.out.println(user);
        }
    }

}
